#include <iostream>
#include "sockdist.h"
#include "sock.h"
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <string>
#include "stdio.h"
#include <cstdlib>
#include <cstring>
using namespace std;

#include "Hote.h"

Hote::Hote(){
}

Hote::Hote(int p, int taille) {
  port = p ;
  tailleTampon = taille;
  tamponRcv = new char[taille];
  tamponSnd = new char[taille];

  memset(tamponRcv,'\0' ,(size_t) taille*sizeof(char));// sizeof de char == 1 !
  memset(tamponSnd,'\0' ,(size_t) taille*sizeof(char));
  // listenner = l;
 } //TODO a virer
Hote::Hote(int p, int taille, ActionListenner* l) {
  port = p ;
  tailleTampon = taille;
  tamponRcv = new char[taille];
  tamponSnd = new char[taille];

  memset(tamponRcv,'\0' ,(size_t) taille*sizeof(char));// sizeof de char == 1 !
  memset(tamponSnd,'\0' ,(size_t) taille*sizeof(char));
  listenner = l;
 
}

char* Hote::conversionStringChar(string str){
size_t size = str.size() + 1;
char * buffer = new char[size];
 strncpy ( buffer , str.c_str(),size);
 return buffer;
}


string Hote::conversionCharString(char* c){
  string  s = c;
return s;

}
